package com.zhoux.service;

import com.zhoux.mapper.UserMapper;
import com.zhoux.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: taoyi
 * @date: 2021/5/31 11:01
 * @version: 1.0
 * @explain:
 */
@Service
public class UserServiceImpl implements UserService{
    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        return userMapper.selectList(null);
    }

    @Override
    public void addUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public User getUserById(Integer id) {
        return userMapper.selectById(id);
    }
}
